#ifndef __GLF_MATH_AABB_H_INCLUDED__
#define __GLF_MATH_AABB_H_INCLUDED__

#include <glf/math/vec3.h>

namespace glf {

/* ------------------------------------------------------------------------
    AABB
    A box along the xyz-axis. This is defined by two points, pmin and pmax.
    Each coordinates of pmin needs to be smaller than the pmax coordinates.
   ------------------------------------------------------------------------ */

template<typename T>
struct Aabb
{
	Aabb() {
	}
	Aabb(const vec3<T>& pmin, const vec3<T>& pmax) :
		pmin(pmin),
		pmax(pmax) {
	}
	Aabb(const Aabb& box) :
		pmin(box.pmin),
		pmax(box.pmax) {
	}

	//Aabb(const vec3<T>& _min, const vec3<T>& _max) { 
	//	pmin = _min;  
	//	pmax =_max;
	//}

	bool operator==(const struct Aabb<T>& rhs) const { 
		return pmin == rhs.pmin && pmax == rhs.pmax; 
	}

    bool operator!=(const struct Aabb<T>& rhs) const { 
		return pmin != rhs.pmin || pmax != rhs.pmax; 
	}

	Vec3<T> pmin;
	Vec3<T> pmax;
};

typedef Aabb<float> Aabbf;

}

#endif
